package com.btl.cygf;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.btl.bean.Person;
import com.btl.utils.SavaPersonInfo;
import com.yzx.yunyanzhengdemo.activity.LoginActivity;

public class SheZhiActivity extends Activity implements OnClickListener{
	
 ImageView login_backtofragment;
 LinearLayout My_list_guanyu;
 LinearLayout My_list_banben;
 LinearLayout My_list_yijian;
 LinearLayout My_list_tuichu;



 
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.shezhi);
		login_backtofragment = (ImageView) findViewById(R.id.login_backtofragment);
		My_list_guanyu = (LinearLayout) findViewById(R.id.My_list_guanyu);
		My_list_banben = (LinearLayout) findViewById(R.id.My_list_banben);
		My_list_yijian = (LinearLayout) findViewById(R.id.My_list_yijian);
		My_list_tuichu = (LinearLayout) findViewById(R.id.My_list_tuichu);
		
		login_backtofragment.setOnClickListener(this);
		My_list_guanyu.setOnClickListener(this);
		My_list_banben.setOnClickListener(this);
		My_list_yijian.setOnClickListener(this);
		My_list_tuichu.setOnClickListener(this);
		
		SharedPreferences share = getSharedPreferences("login", Activity.MODE_PRIVATE);
		String id = share.getString("id", "");
		
		if(id.equals("")) {
			My_list_tuichu.setVisibility(View.GONE);
		} else {
			My_list_tuichu.setVisibility(View.VISIBLE);
		}
		

	}
		// 点击返回
				@Override
				public void onClick(View v) {
					switch (v.getId()) {
					case R.id.login_backtofragment:
						this.finish();
						break;
					case R.id.My_list_guanyu:
						Intent it1 = new Intent();
						it1.setClass(this, GuanYuActivity.class);
						startActivity(it1);
						break;
					case R.id.My_list_banben:
						Intent it2 = new Intent();
						it2.setClass(this, BanBenActivity.class);
						startActivity(it2);
						break;
					case R.id.My_list_yijian:
						SharedPreferences share1 = this.getSharedPreferences("login",
								Activity.MODE_WORLD_READABLE);

						String pid = share1.getString("id", "");
						if (!pid.equals("")) {
							Intent it3 = new Intent();
							it3.setClass(this, YiJianActivity.class);
							startActivity(it3);
						} else {
							Intent it5 = new Intent();
							it5.setClass(this, LoginActivity.class);
							startActivity(it5);
						}
						break;

					case R.id.My_list_tuichu:
						
						
						
						SavaPersonInfo.saveInfo(this, new Person());
						Intent it4 = new Intent();
						it4.setClass(this, MainActivity.class);
						it4.putExtra("type", 1);
						it4.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
						startActivity(it4);
						break;
					

	}
	  }
				}

